SQL in easy steps 4th Edition by Mike McGrath

SQL in easy steps 4th Edition by Mike McGrath

Author:Mike McGrath
Language: eng
Format: epub
Publisher: In Easy Steps
Published: 2020-06-21T16:00:00+00:00


Comparing alternative lists

A WHERE clause in a SELECT query can specify a list of alternative values for comparison with column data using the IN keyword. This is followed by a comma-separated list of values within a single pair of parentheses. The syntax looks like this:

SELECT data FROM table-name

WHERE column IN ( value , value , value ) ;

When the column data matches any one of the values in the list, the WHERE clause evaluates as true, and data is returned for that row. The comparison can be inverted by preceding the IN keyword with the NOT keyword. Then, the WHERE clause only evaluates as true when no list value matches the column data.

The SQL script listed below demonstrates the comparison of multiple values using both IN and NOT IN clauses:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.